home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Texteditors / Origami / bindings / fun / error-buff < prev    next >
Encoding:
Text File  |  1996-09-27  |  5.3 KB  |  182 lines

  1. @if-using not(ocl-file-error-buff)
  2.    @use (ocl-file-error-buff)
  3.    ;OCL{{{}}}
  4.    ;OCL{{{  reference description
  5.    @if-using ( FUN-REFERENCE ) ; 1 ;
  6.    This libary defines the function `show-error-buffer'. It  opens  a  new
  7.    buffer with file `dev/null', inserting  all  stored  messages ( Origami
  8.    stores all messages in a special history!).
  9.    @fi
  10.    ;OCL}}}
  11.    ;OCL{{{  libaries
  12.    @if-using not(ocl-file-hide-buffer) @lib hide-buffer @fi
  13.    @if-using not(ocl-file-buff-size)   @lib buff-size   @fi
  14.    ;OCL}}}
  15.    ;OCL{{{  variables
  16.    ( defvar ( err-buff-caller err-buff-x err-buff-dummy ) )
  17.    ;OCL}}}
  18.    ;OCL{{{  local functions
  19.    ( deffun ( rename ) get-error-msg
  20.       ( if test-view
  21.          ( delete-mode-view
  22.            get-error-msg(rename)
  23.            add-mode-view
  24.          )
  25.         else
  26.          (
  27.            ;OCL{{{  get number of msg's
  28.            history-edit error-list ()
  29.            do
  30.             ( previous-line
  31.               set modify-behaviour +(modify-behaviour 1)
  32.             )
  33.            while not(test-begin-line)
  34.            newline-and-indent
  35.            ;OCL}}}
  36.            ;OCL{{{  put msg's
  37.            while >(modify-behaviour 0)
  38.             ( beginning-of-line
  39.               newline-and-indent
  40.               previous-line
  41.               get-history error-list modify-behaviour
  42.               set-file-unchanged
  43.               next-line
  44.               set modify-behaviour -(modify-behaviour 1)
  45.             )
  46.            ;OCL}}}
  47.            if rename
  48.             ;OCL{{{  rename the buffer
  49.             ( change-buffername
  50.                  "message-history
  51.                  newline-and-indent
  52.               set-file-unchanged
  53.             )
  54.             ;OCL}}}
  55.            fi
  56.          )
  57.         fi
  58.       )
  59.    )
  60.    ;OCL}}}
  61.    ;OCL{{{  show-error-buffer
  62.    ;OCL{{{  reference
  63.    @if-using ( FUN-REFERENCE ) ; 2 ; show-error-buffer-called
  64.    ;OCL{{{  @error-buff-ref show-error-buffer
  65.    Displayes a buffer  with  file  `dev/null',  inserting  all  stored
  66.    messages ( Origami stores all messages in a  special  history!)  and
  67.    offers a menu for contolling the display of the buffer.
  68.    ;OCL}}}
  69.    @fi
  70.    ;OCL}}}
  71.    ( deffun show-error-buffer
  72.       ( set err-buff-caller current-buffer-id
  73.         open-hidden-dummy-buffer(true)
  74.         full-size-buffer
  75.         set err-buff-dummy current-buffer-id
  76.         get-error-msg(true)
  77.         screen-on
  78.         redraw-display
  79.         ;OCL{{{  prompt for next
  80.         local
  81.          ()
  82.          ( do
  83.             (
  84.               ;OCL{{{  up/down or quit
  85.               set err-buff-x 1
  86.               begin-prompt-macro
  87.               menu-counter
  88.                  err-buff-x
  89.                ( "Up "  "Quit "  "Down "  "  "Left "  "Right )
  90.               end-prompt-macro
  91.               ;OCL}}}
  92.               case
  93.                ;OCL{{{  show next page
  94.                ( =(err-buff-x 0) ( previous-page ) )
  95.                ;OCL}}}
  96.                ;OCL{{{  show previous page
  97.                ( =(err-buff-x 2) ( next-page ) )
  98.                ;OCL}}}
  99.                ;OCL{{{  shift left
  100.                ( =(err-buff-x 3) ( repeat screen-width ( backward-character ) ) )
  101.                ;OCL}}}
  102.                ;OCL{{{  shift right
  103.                ( =(err-buff-x 4) ( repeat screen-width ( forward-character ) ) )
  104.                ;OCL}}}
  105.               default
  106.                ;OCL{{{  break from loop, new target found
  107.                ( return-from-macro )
  108.                ;OCL}}}
  109.               esac
  110.             )
  111.            while true
  112.          )
  113.         ;OCL}}}
  114.         ;OCL{{{  return to calling buffer
  115.         screen-off
  116.         leave-hidden-dummy-buffer(err-buff-caller)
  117.         set err-buff-dummy 0
  118.         ;OCL}}}
  119.       )
  120.    )
  121.    ;OCL}}}
  122.    ;OCL{{{  open-error-buffer
  123.    ;OCL{{{  reference
  124.    @if-using ( FUN-REFERENCE ) ; 2 ; open-error-buffer-called
  125.    ;OCL{{{  @error-buff-ref open-error-buffer
  126.    Opens a new  buffer  with  file  `dev/null',  inserting  all  stored
  127.    messages ( Origami stores all messages in a  special  history!).
  128.    ;OCL}}}
  129.    @fi
  130.    ;OCL}}}
  131.    ( deffun open-error-buffer
  132.       ( screen-off
  133.         ;OCL{{{  get dev/null buffer
  134.         local
  135.          ( modify-behaviour )
  136.          ( set modify-behaviour -2
  137.            open-buffer
  138.          )
  139.         ;OCL}}}
  140.         get-error-msg(false)
  141.         screen-on
  142.         redraw-display
  143.       )
  144.    )
  145.    ;OCL}}}
  146.    ;OCL{{{  reference hooks
  147.    @if-using ( FUN-REFERENCE ) ; 3 ;
  148.    The  libary  defines  a  macro   `abort-hook-add'   and   a   OCL   tag
  149.    ABORT-HOOK-ADD.  This  macro  should be added to your  abort-macro!  If
  150.    needed, an existing macro `abort-hook-add' will be integrated!
  151.  
  152.    show-error-buffer uses `begin-prompt-macro' and  `end-prompt-macro'  to
  153.    get the right mode for reading the commands.
  154.    @fi
  155.    ;OCL}}}
  156.    ;OCL{{{  abort-hook-add
  157.    @if-using not(ABORT-HOOK-ADD)
  158.       @use (ABORT-HOOK-ADD)
  159.       ( defmac abort-hook-add ( ) )
  160.    @fi
  161.    ( defmac abort-hook-add-saved ( abort-hook-add ) )
  162.    ( undeclare ( abort-hook-add ) )
  163.    ( defmac abort-hook-add
  164.       ( abort-hook-add-saved
  165.         if err-buff-dummy
  166.          ( goto-buffer-id err-buff-dummy
  167.            set err-buff-dummy 0
  168.            set-file-unchanged
  169.            exit-buffer
  170.            goto-buffer-id err-buff-caller
  171.            restore-buffer-layout
  172.          )
  173.         fi
  174.       )
  175.    )
  176.    ( undeclare ( abort-hook-add-saved ) )
  177.    ;OCL}}}
  178.    ;OCL{{{  undeclares
  179.    ( undeclare ( err-buff-caller err-buff-x err-buff-dummy get-error-msg ) )
  180.    ;OCL}}}
  181. @fi
  182.